Scroll.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. "use client";
  2. const Scroll = () => {
  3. const scrollToTop = () => {
  4. const parentEle = document.querySelector("#maincontainer");
  5. parentEle!.scrollTo({ top: 0, behavior: "smooth" });
  6. };
  7. return (
  8. <div className={"mt-[0.1rem] flex items-center justify-around pb-[0.5rem] text-[#fff]"}>
  9. <div
  10. className={
  11. "h-[0.45rem] w-[0.45rem] rounded bg-gradient-to-b from-[#ff9323]" +
  12. " flex items-center justify-center to-[#ff6a01]"
  13. }
  14. >
  15. <span className={"iconfont icon-shoucang text-[0.15rem]"}></span>
  16. </div>
  17. <div
  18. className={
  19. "flex h-[0.46rem] w-[0.46rem] rounded-[0.02rem] bg-[#25272c]" +
  20. " flex-col items-center justify-center text-[0.12rem]"
  21. }
  22. onClick={scrollToTop}
  23. >
  24. <span className={"iconfont icon-xiangshang text-[#ff6a01]"}></span>
  25. Top
  26. </div>
  27. </div>
  28. );
  29. };
  30. export default Scroll;